#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
#include <map>
using namespace std;
typedef long long ll; 
const int MAXN=1e4+7;
struct node {
	ll num;
	bool in;
	bool operator ==(const node& a) {
		return num==a.num&&in==a.in;
	}
	bool operator <(const node& a) {
		return num<a.num;
	}
	bool operator >(const node& a) {
		return num>a.num;
	}
	bool operator <=(const node& a) {
		return num<=a.num;
	}
	bool operator >=(const node& a) {
		return num>=a.num;
	}
};
bool cmp(node a, node b) {
	return a.num<b.num;
}
vector<int> cnt[MAXN];
map<ll, bool> ma[MAXN];
int main() {
	ll g;
	scanf("%I64d", &g);
	ll x,y,r;
	node tmp;
	for (ll i=0; i<g; ++i) {
		scanf("%I64d%I64d", &x, &y);
		cnt[x].push_back(y);
		ma[x][y]=false;
	}
	for (ll i=0; i<MAXN; ++i) sort(cnt[i].begin(), cnt[i].end());
	scanf("%I64d", &g);
	double st,en;
	ll st1,en1;
	for (ll i=0; i<g; ++i) {
		scanf("%I64d%I64d%I64d", &x, &y, &r);
		st1=max((ll)0, x-r); en1=min(MAXN-(ll)1, x+r);
//		cout<<st1<<"->>"<<en1<<endl;
		for (ll j=st1; j<=en1; ++j) {
			st=(double)y-(double)sqrt(double(r*r-(j-x)*(j-x))); en=(double)y+(double)sqrt((double)(r*r-(j-x)*(j-x)));
			st=(int)(st-0.001)+1;
//			if (cnt[j].size()>0)cout<<cnt[j].begin()->num<<"---vs---"<<(cnt[j].end()-1)->num<<endl;
			if (cnt[j].size()<1 || cnt[j][cnt[j].size()-1]<st || cnt[j][0]>en) continue;
			for (int k=st; k<=en; ++k) {
				if (ma[j].count(k)) ma[j][k]=true;
			}
		}
	}
	ll res=0;
	for (ll i=0; i<MAXN; ++i) {
		ll len=cnt[i].size();
		for (ll j=0; j<len; ++j) {
			if (ma[i][cnt[i][j]]==false) ++res;
//			if (cnt[i][j].in) cout<<i<<' '<<cnt[i][j].num<<endl;
		}
	}
	cout<<res<<endl;
	return 0;
}
